package com.xiaomi.service.Impl;



import com.xiaomi.dao.CpMapper;
import com.xiaomi.dao.CpguigeMapper;
import com.xiaomi.entity.Cpguige;

import com.xiaomi.service.CpguigeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @ClassName CpguigeServicelmpl
 * @Description TODO
 * @Author HP
 * @Date 2021/11/29 0:06
 */
@Service
public class CpguigeServicelmpl implements CpguigeService {
    @Resource
    CpguigeMapper cpguigeMapper;
@Resource
    CpMapper cpMapper;



    @Override
    public List<Cpguige> selectAll(Map<String, Object> pars) {
        List<Cpguige> cpguigeList=cpguigeMapper.selectAll(pars);
        for (Cpguige cpguige:cpguigeList){
            cpguige.setCp(cpMapper.selectByCpid(cpguige.getCpid()));
        }
         return cpguigeList;
    }

    @Override
    public int count(Map<String, Object> pars) {
        return cpguigeMapper.count(pars);
    }

    @Override
    public int add(Cpguige cpguige) {
        return cpguigeMapper.add(cpguige);
    }

    @Override
    public int del(int id) {
        return cpguigeMapper.del(id);
    }

    @Override
    public int update(Cpguige cpguige) {
        return cpguigeMapper.update(cpguige);
    }
}
